import org.junit.Assert;
import org.junit.Test;
import org.s166.stu.dao.StudenDao;
import org.s166.stu.dao.impl.StudentDaoImpl;
import org.s166.stu.entity.Student;
import org.s166.stu.util.DBUtil;

import java.sql.Connection;

public class Maintest {
    @Test
    public void testConnection(){
        Connection conn = DBUtil.getConnection();
        System.out.println(conn);
    }
    @Test
    public void testStudentDao(){
        StudenDao dao=new StudentDaoImpl();
        Student stu = dao.login("wd", "123123");
        if(stu!=null){
            System.out.println("登录成功");
        }else{
            System.out.println("帐号或者密码错误");
        }
    }
    @Test
    public void testAddStudent(){
        StudenDao dao=new StudentDaoImpl();
        Student stu=new Student("gzs","124053","古",11,"男");
        int r = dao.addStudent(stu);
        Assert.assertEquals(1,r);
        System.out.println(r);
    }
}
